﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Extensibility;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap;
using Microsoft.Practices.Unity;
using YasharEl.Infrastructure.ObjectFactory.Unity;
using YasharEl.Infrastructure.ObjectFactory;
using System.Configuration;

namespace YasharEl.Infrastructure.ApplicationModel.Service.Bootstrap
{
    public class WindowsServiceApplicationUnityBootstrapper : BaseBootstrapper<IComplexBootstrappingExtension>
    {
        #region Fields

        private UnityContainer unityContainer;

        #endregion

        #region BaseBootstrapper<IComplexBootstrappingExtension> Implementations

        protected override BaseDependencyContainer CreateContainer()
        {
            unityContainer = new UnityContainer();
            UnityDependencyContainer dependencyContainer = new UnityDependencyContainer(unityContainer);

            return dependencyContainer;
        }

        protected override void ConfigureContainer()
        {
            unityContainer.ConfigureUnityContainer(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None));
        }

        protected override void PerformPostStartupTask()
        {
        }

        #endregion
    }
}
